package com.solution.admin.product.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.solution.admin.product.dao.ProductCategoryPropertyFilterDao;
import com.solution.admin.product.entity.ProductCategoryPropertyFilterEntity;
import com.solution.common.dao.impl.BaseDaoImpl;
import com.solution.common.page.PageBean;
import com.solution.common.page.PageParam;

/**
 * 商品分类搜索筛选项DAO实现
 * @author lilp
 * @date 2017-10-09 23:17:28
 */
@Repository
public class ProductCategoryPropertyFilterDaoImpl extends BaseDaoImpl<ProductCategoryPropertyFilterEntity> implements ProductCategoryPropertyFilterDao {

	/**
	 * 保存商品分类搜索筛选项信息
	 * @param productCategoryPropertyFilterEntity
	 * @return
	 * @author lilp
	 * @date 2017-10-09 23:17:28
	 */
	@Override
	public long saveProductCategoryPropertyFilter(ProductCategoryPropertyFilterEntity productCategoryPropertyFilterEntity) {
		return super.insert(productCategoryPropertyFilterEntity);
	}

	/**
	 * 分页查询商品分类搜索筛选项信息
	 * @param pageParam 分页对象
	 * @param productCategoryPropertyFilter 分页参数
	 * @return PageBean 分页参数及数据
	 * @author lilp
	 * @date 2017-10-09 23:17:28
	 */
	public PageBean listProductCategoryPropertyFilterPage(PageParam pageParam, Map<String, Object> param) {
		return super.listPage(pageParam, param);
	}

	/**
	 * 更新商品分类搜索筛选项
	 * @param productCategoryPropertyFilterEntity
	 * @return
	 * @author lilp
	 * @date 2017-10-09 23:17:28
	 */
	@Override
	public int updateProductCategoryPropertyFilter(ProductCategoryPropertyFilterEntity productCategoryPropertyFilterEntity) {
		return super.update(productCategoryPropertyFilterEntity);
	}

	/**
	 * 删除商品分类搜索筛选项
	 * @param productCategoryPropertyFilterId
	 * @return
	 * @author lilp
	 * @date 2017-10-09 23:17:28
	 */
	public int deleteProductCategoryPropertyFilterById( Long id) {
		return super.deleteById(id);
	}
	
	/**
	 * 根据条件查询商品分类搜索筛选项
	 * @param param
	 * @return
	 * @author lilp
	 * @date 2017-10-09 23:17:28
	 */
	@Override
	public List<ProductCategoryPropertyFilterEntity> listProductCategoryPropertyFilter( Map<String, Object> param) {
		return super.listBy(param);
	}
	
	/**
	 * 查询商品列表页面商品筛选项
	 * @param param
	 * @return
	 */
	@Override
	public List<ProductCategoryPropertyFilterEntity> listProductCategoryPropertyFilterForIndex(
			Map<String, Object> param){
		return getSessionTemplate().selectList(getStatement("listProductCategoryPropertyFilterForIndex"),param);
	}

	/**
	 * 获取该品类下最大排序值
	 * @param productCategoryId
	 * @return
	 * @author xkl
	 * @date 2018年4月21日 下午4:11:58
	 */
	@Override
	public int getMaxSortNo(Integer productCategoryId) {
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("productCategoryId", productCategoryId);
		return getSessionTemplate().selectOne(getStatement("getMaxSortNo"), paramMap);
	}
}
